home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 January / PC Plus Super CD No55a (PCP-147A-1-99) (Disc 1) (1998).iso / linux / developers / visualtcl / windows / vtcl / demo / ex1_cmpd.tcl < prev    next >
Encoding:
Text File  |  1997-03-27  |  7.4 KB  |  120 lines

  1. set vTcl(cmpd,list) "drawtool"
  2.  
  3. set {vTcl(cmpd:drawtool)} {{frame {-borderwidth 1 -height 30 -relief raised -width 30} {pack {-anchor center -expand 1 -fill both -padx 5 -pady 5 -side top}} {} {} {{canvas {-borderwidth 2 -height 246 -highlightthickness 0 -relief ridge -width 351} {grid {-column 0 -row 0 -columnspan 1 -rowspan 6 -padx 5 -pady 5 -sticky nesw}} {{<Button-1> {
  4.         drawtool:button-down %x %y
  5.     }} {<B1-Motion> {
  6.         drawtool:button-motion %x %y
  7.     }} {<ButtonRelease-1> {
  8.         drawtool:button-release %x %y
  9.     }}} {} {} .01 CANVAS {} {} {}} {frame {-borderwidth 1 -height 30 -relief sunken -width 30} {grid {-column 1 -row 0 -columnspan 1 -rowspan 1 -padx 5 -pady 5 -sticky n}} {} {} {{button {-command {set tool free} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -highlightthickness 0 -image free -padx 11 -pady 4 -text free} {pack {-anchor center -expand 1 -fill both -side top}} {} {} {} .02.03 {} {} {} {}} {button {-command {set tool line} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -highlightthickness 0 -image line -padx 11 -pady 4 -text line} {pack {-anchor center -expand 1 -fill both -side top}} {} {} {} .02.04 {} {} {} {}} {button {-command {set tool rect} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -highlightthickness 0 -image rect -padx 11 -pady 4 -text rect} {pack {-anchor center -expand 1 -fill both -side top}} {} {} {} .02.05 {} {} {} {}} {button {-command {set tool ellipse} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -highlightthickness 0 -image oval -padx 11 -pady 4 -text ellipse} {pack {-anchor center -expand 1 -fill both -side top}} {} {} {} .02.06 {} {} {} {}} } .02 {} {} {} {}} {frame {-borderwidth 2 -height 45 -relief groove -width 45} {grid {-column 1 -row 1 -columnspan 1 -rowspan 1 -padx 5 -pady 5}} {} {} {{frame {-background #ffffff -borderwidth 1 -height 30 -relief raised -width 30} {place {-x 15 -y 15 -width 25 -height 25 -anchor nw -bordermode ignore}} {} {} {} .07.08 {} {} {} {}} {frame {-background #000000 -borderwidth 1 -height 30 -relief raised -width 30} {place {-x 5 -y 5 -width 25 -height 25 -anchor nw -bordermode ignore}} {} {} {} .07.09 {} {} {} {}} } .07 {} {} {} {}} {label {-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -text select} {grid {-column 1 -row 3 -columnspan 1 -rowspan 1}} {} {} {} .010 {} {} {} {}} {label {-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -text {a tool}} {grid {-column 1 -row 4 -columnspan 1 -rowspan 1}} {} {} {} .011 {} {} {} {}} {button {-command exit -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -highlightthickness 0 -padx 9 -pady 3 -text Quit} {grid {-column 1 -row 5 -columnspan 1 -rowspan 1 -padx 5 -pady 5 -sticky ns}} {} {} {} .012 {} {} {} {}} } {} {} {{columnconf 0 -weight 1} {columnconf 1 -minsize 45} {rowconf 5 -weight 1} {rowconf 1 -minsize 45}} {{drawtool:button-down {sx sy} {
  10. global tool x y obj widget
  11.  
  12. switch $tool {
  13.     free -
  14.     line {
  15.         set x $sx
  16.         set y $sy
  17.         set obj [$widget(CANVAS) create line $x $y $x $y]
  18.     }
  19.     rect {
  20.         set x $sx
  21.         set y $sy
  22.         set obj [$widget(CANVAS) create rectangle $x $y $x $y]
  23.     }
  24.     ellipse {
  25.         set x $sx
  26.         set y $sy
  27.         set obj [$widget(CANVAS) create arc $x $y $x $y -start 0 -extent 359 -style arc]
  28.     }
  29. }
  30. }} {drawtool:button-motion {nx ny} {
  31. global tool x y obj widget
  32.  
  33. switch $tool {
  34.     free {
  35.         $widget(CANVAS) create line $x $y $nx $ny
  36.         set x $nx
  37.         set y $ny
  38.     }
  39.     line -
  40.     rect -
  41.     ellipse {
  42.         $widget(CANVAS) coords $obj $x $y $nx $ny
  43.     }
  44. }
  45. }} {drawtool:button-release {nx ny} {
  46. global tool x y
  47.  
  48. switch $tool {
  49. }
  50. }} {drawtool:init args {
  51. global vTcl tcl_platform tcl_version tk_strictMotif img
  52. catch {package require unsafe}
  53. set tk_strictMotif 1
  54.  
  55. set img(line) {
  56.     R0lGODdhKAAoAPUAAAAAADj4MEDsMEjkMFBQ+FDcMFjQMGDIMGjAMHB0cHC4MHikOHisMIB8
  57.     eICAgICcOIiQOJCIOJiAOKB4OKC0yKDEyKgoGKhsOLBkOLhcOLi4uMBQOMDAwMhIOMjEwNBA
  58.     ONg4ONh8eOAsOOC4gOgkOPAcOPC4OPgUQPiIOPj8+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  59.     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAKAAoAAAG
  60.     f8CUcEgsGo/IpHLJbDqf0Kj0CKhOo9Us4NrUerlJrxhc1KbM5yw5vRV+2e2r2t22DtFYO31f
  61.     jj/nd3F6XICBhmCFh2xrVH5pjEaDj5BEkpOUl4qUlplrnJ1kn4mIjpWlhKd8jJ+qoamtmJGs
  62.     sbOYtbavtLm4sb2+v8DBwsPEv0EAOw==
  63. }
  64. set img(rect) {
  65.     R0lGODdhKAAoAPUAAAAAADj4MEDsMEjkMFBQ+FDcMFjQMGDIMGjAMHB0cHC4MHikOHisMIB8
  66.     eICAgICcOIiQOJCIOJiAOKB4OKC0yKDEyKgoGKhsOLBkOLhcOLi4uMBQOMDAwMhIOMjEwNBA
  67.     ONg4ONh8eOAsOOC4gOgkOPAcOPC4OPgUQPiIOPj8+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  68.     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAKAAoAAAG
  69.     XsCUcEgsGo/IpHLJbDqf0Kh0Sq1ar9isdsvtOgHgsHhMBkfLaPQZMDVD3eu4FP5lz+1Peh5f
  70.     b/Oben1vf4J7fnKIhYOJhot3jIqAaZNha5STXpmam5ydnp+goaKjVkEAOw==
  71. }
  72. set img(oval) {
  73.     R0lGODdhKAAoAPUAAAAAADj4MEDsMEjkMFBQ+FDcMFjQMGDIMGjAMHB0cHC4MHikOHisMIB8
  74.     eICAgICcOIiQOJCIOJiAOKB4OKC0yKDEyKgoGKhsOLBkOLhcOLi4uMBQOMDAwMhIOMjEwNBA
  75.     ONg4ONh8eOAsOOC4gOgkOPAcOPC4OPgUQPiIOPj8+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  76.     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAKAAoAAAG
  77.     YsCUcEgsGo/IpHLJbDqf0Kh0Sq1ar9isdstVAr5gQDcFPpax32a6Koa2pW83nC23xpf3uTqb
  78.     N/P3aIBXfX52T4SHdVOISYyNVI5GkV6Ta4OWRGdcYZpjnp+goaKjpKWmp11BADs=
  79. }
  80. set img(free) {
  81.     R0lGODdhKAAoAPcAAAAAALi4uNh8eOC4gPC4OPj8+AEUAEAIAMg0E6D4ABT/AAi/ABA1Aa+y
  82.     ABQBAAhAAMQsuKeppxQUFAgICMi04DL39gj//0C/vw4EwMAA9gEA/0AAv1DIbwEytQAIAQBA
  83.     QDjIyKigoBDIEK+gr+AkvPivp/8UFL8ICDEb5v22pwIAFEAACDYEEKgArxQAFAgACGjInrSg
  84.     vQwUAQgIQMFkG4r4AA3/AEC/AIwEDVoAABQAAEAAAADIGACgAAAUAAQIADBw/Nb4pxD/FAy/
  85.     CDA1HNay9xAB/whAv+gETskAkhEAB1DInqigvRQUATgEG6gAAAgAAMjIDTKgAAgUAPyIGPj4
  86.     AP//AL+/AJQ1BLWyqAQBFEBACAnQHACn9wAU/wAIvwgIgKf4khT/Bwi/CEwEyAIAoAAAFAAA
  87.     CMjIgzIyAAgIAEBABRjIEPmgr8TIG7+gAAQUAIAkEKavABQUAAgbGae2AEwEEgIAAGS4KPn4
  88.     9////7+/v701LnmymggBBwhACGwE8MKozwwUEwA4AQD4AAD/AAC/ANgENfkAJ/8AEb8ACLDI
  89.     OA0y9xYI/8jIFTKgjQgUB0AICNTIrPmgzf8UE9gkhPmv/P8U/78Iv7AAOA0A+hYA/wgAv5TI
  90.     v/mggf8UBaAQDayvAAcUAAAgAACpAAAIAAHIhAAy/AAI/wBAvygOhADA/AAB/yhSqAAB+QAA
  91.     /wAAvwCkAAAQAAGvANyMAPn4ANgxAPn9AP8CAL9AAJSahPmp/Nz8JKz4rwf/FLAKGw0AthYA
  92.     ACjsTwAAdgAAZQAAcihudwAAaQAFdAAHZQD5IAD/ZQC/eIQKafwAc/8AdL8AaQCgBABvyAC1
  93.     oAABFABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  94.     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  95.     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAKAAoAAAIngALCBxIsKDBgwgTKlzIsKHD
  96.     hxAjSlQIoOLEiAAEaARw8WHGjR0bVgQZkiGAABk5lqQYoKXKlQkruoQZk0DFlzQNAiDAE2fO
  97.     gTt7/jwY1ObQgkV9Hk16lCDTpkB5GoVa4ClVq02xZpWq9KfWpVxNdvxKdOyAAVPFTgRwtitC
  98.     tyYterwod+5YpHWRlnzJVyfMm3hvwqVKuLDhw4gTNw0IADs=
  99. }
  100.  
  101. if {$tcl_version < 7.7} {
  102.     if {[info exists vTcl(VTCL_DIR)]} {
  103.         set base [file join $vTcl(VTCL_DIR) demo]
  104.     } else {
  105.         set base [pwd]
  106.     }
  107.     image create photo free -file [file join $base images free.gif]
  108.     image create photo line -file [file join $base images line.gif]
  109.     image create photo rect -file [file join $base images rect.gif]
  110.     image create photo oval -file [file join $base images oval.gif]
  111. } else {
  112.     foreach i {free line rect oval} {
  113.         image create photo $i -data $img($i)
  114.     }
  115. }
  116. }} {drawtool:main args {
  117.  
  118. }}} drawtool} {{.top28.fra29.can30 .01} {.top28.fra29.fra31.01 .02.03} {.top28.fra29.fra31.02 .02.04} {.top28.fra29.fra31.03 .02.05} {.top28.fra29.fra31.04 .02.06} {.top28.fra29.fra31 .02} {.top28.fra29.fra32.01 .07.08} {.top28.fra29.fra32.02 .07.09} {.top28.fra29.fra32 .07} {.top28.fra29.lab33 .010} {.top28.fra29.lab34 .011} {.top28.fra29.but35 .012} {.top28.fra29 }}}
  119.  
  120.